package multisistema;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.UIManager;
import multisistema.objetos.Usuario;

/**
 *
 * @author isaac
 */
public class Principal extends javax.swing.JFrame {

    private Usuario user;
    /**
     * Creates new form Principal
     */
    public Principal() {
        initComponents();
        this.setLayout(new BorderLayout());
        init();
        this.setExtendedState(this.getExtendedState()|JFrame.MAXIMIZED_BOTH);
    }

    public void setMiembros() {
        Miembros miens = new Miembros(this);
        miens.setVisible(true);
        getContentPane().removeAll();
        this.add(miens, BorderLayout.CENTER);
        this.validate();
    }
    
    public void setTransacciones() {
        Transacciones trans = new Transacciones(this);
        trans.setVisible(true);
        getContentPane().removeAll();
        this.add(trans, BorderLayout.CENTER);
        this.validate();
    }

    public void setMain() {
        setPortada();
    }

    private void setPortada() {
        Portada port = new Portada(this);
        port.setVisible(true);
        getContentPane().removeAll();
        this.add(port, BorderLayout.CENTER);
        this.validate();
    }
    
    public void init(){
        Login log = new Login(this);
        log.setVisible(true);
        getContentPane().removeAll();
        this.add(log, BorderLayout.CENTER);
        this.validate();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Multisistema");
        setMinimumSize(new java.awt.Dimension(1000, 600));
        getContentPane().setLayout(new java.awt.BorderLayout());

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            // Set System L&F
            UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    /**
     * @return the user
     */
    public Usuario getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(Usuario user) {
        this.user = user;
    }

    public void setUsuarios() {
        Usuarios usr = new Usuarios(this);
        usr.setVisible(true);
        getContentPane().removeAll();
        this.add(usr, BorderLayout.CENTER);
        this.validate();
    }

    public void informe_ingresos_egresos() {
        Miembros miens = new Miembros(this);
        miens.setVisible(true);
        getContentPane().removeAll();
        this.add(miens, BorderLayout.CENTER);
        this.validate();
    }

}
